/**
 * gcog - generate code with inlined Groovy code.
 * http://code.google.com/p/gcog/
 * 
 * Copyright 2008, Tobias Hientzsch.
 * 
 * MIT license http://www.opensource.org/licenses/mit-license.php
 * 
 * Original idea and code from Cog code generation tool.
 * http://nedbatchelder.com/code/cog
 *
 * Copyright 2004-2008, Ned Batchelder.
 * 
 */
 
public class NumberedFileReader{
	BufferedReader f
	def n
	
	def NumberedFileReader(def f) {
		if(f instanceof File) { 
		 this.f = new BufferedReader(new FileReader(f))
		} else if(f instanceof Reader) { 
			 this.f = new BufferedReader(f)
		} 
		n = 0
	}
	
	def String readLine() {
		def l = f.readLine()
		if(l) { 
			n += 1
		}
		return l
	}
	
    def linenumber() {
        return n
    }
}
